package cn.edu.hubu.hubusmartmedicalsystem.controller;


import cn.edu.hubu.hubusmartmedicalsystem.entity.Schedule;
import cn.edu.hubu.hubusmartmedicalsystem.entity.Schedule1;
import cn.edu.hubu.hubusmartmedicalsystem.service.Schedule1Service;
import cn.edu.hubu.hubusmartmedicalsystem.vo.ResultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin
public class ScheduleController {
    @Autowired
    private Schedule1Service schedule1Service;

    @RequestMapping("/user/schedule")
    public ResultVO getschedule(){

        ResultVO<List<Schedule1>> scheduleAll = schedule1Service.getScheduleAll();
        return scheduleAll;
    }
    @RequestMapping("/user/schedulebydeptname")
    public  ResultVO getschedulebydept(String deptName){
        ResultVO<List<Schedule1>> scheduleBydeptname = schedule1Service.getScheduleBydeptname(deptName);
        return  scheduleBydeptname;

    }
    @RequestMapping("/admin/updateschedule")
    public  ResultVO updateschedule(Schedule schedule){
        ResultVO<String> updateschedule = schedule1Service.updateschedule(schedule);
        return updateschedule;
    }
    @RequestMapping("/admin/schedule")
    public ResultVO getschedulebyadmin(){
        ResultVO<List<Schedule>> getschedulebyadmin = schedule1Service.getschedulebyadmin();
        return getschedulebyadmin;
    }

}
